package com.lz.date;

import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;

public class app {
    public static void main(String[] args) throws InterruptedException {
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("+8"), Locale.SIMPLIFIED_CHINESE);
        Date time = calendar.getTime();
        System.out.println(time);

        // test1();
        for (; ; ) {
            test2();
        }
    }

    private static void test2() throws InterruptedException {
        Date date = new Date();

        TimeUnit.SECONDS.sleep(1);
        System.out.println(date);

    }

    private static void test1() {
        Date now = new Date();
        Calendar instance1 = Calendar.getInstance();
        instance1.set(2010, Calendar.MONTH, 12);
        Date begin = instance1.getTime();
        Calendar instance = Calendar.getInstance();
        instance.set(2020, Calendar.MONTH, 12);
        Date after = instance1.getTime();
        boolean after1 = now.after(null);
        boolean before = now.before(null);
        System.out.println(before + "=" + after1);
    }
}
